package com.py.credit.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.py.credit.entity.IndexCatModel;
import com.py.credit.entity.Model;
import com.py.framework.core.common.Page;

public interface ModelBaseDao {
	List<Model> getListForPage(@Param(value = "sortType") String sortType, @Param(value = "page") Page page);

	/**
	 * 获取列表
	 * 
	 * @return
	 */
	public List<Map<String, Object>> selectByConditionForPage(@Param(value = "columns") List<String> columns,
			@Param(value = "additionalColumns") String[] additionalColumns,
			@Param(value = "conditions") List<String> conditions, @Param(value = "page") Page page,
			@Param(value = "kId") String kId, @Param(value = "areaId") String areaId,
			@Param(value = "industryId") String industryId);

	/**
	 * 添加模型
	 * 
	 * @param ruleName
	 * @param ruleDesc
	 * @param rulePackage
	 * @param ruleMethod
	 * @param time
	 * @param managerId
	 */
	void insert(@Param(value = "id") String id, @Param(value = "bm") String bm, @Param(value = "name") String name,
			@Param(value = "des") String des, @Param(value = "scoreType") String scoreType,
			@Param(value = "rate") double rate, @Param(value = "zone") String zone,
			@Param(value = "industry") String industry, @Param(value = "reportType") String reportType,
			@Param(value = "mainType") String mainType, @Param(value = "relatedModel") String relatedModel);

	/**
	 * 修改模型
	 * 
	 * @param ruleName
	 * @param ruleDesc
	 * @param rulePackage
	 * @param ruleMethod
	 * @param time
	 * @param managerId
	 */
	void update(@Param(value = "id") String id, @Param(value = "bm") String bm, @Param(value = "name") String name,
			@Param(value = "des") String des, @Param(value = "scoreType") String scoreType,
			@Param(value = "rate") double rate, @Param(value = "zone") String zone,
			@Param(value = "industry") String industry, @Param(value = "reportType") String reportType,
			@Param(value = "mainType") String mainType, @Param(value = "relatedModel") String relatedModel);

	/**
	 * 修改模型
	 * 
	 * @param ruleName
	 * @param ruleDesc
	 * @param rulePackage
	 * @param ruleMethod
	 * @param time
	 * @param managerId
	 */
	void updateProcess(@Param(value = "id") String id, @Param(value = "templateType") String templateType,
			@Param(value = "checkType") String checkType, @Param(value = "checkProcess") String checkProcess);

	/**
	 * @param type
	 * @return
	 */
	Integer selectQueryCountByType(@Param(value = "type") int type);

	/**
	 * @param type
	 * @return
	 */
	List getRankList(@Param(value = "id") String id);

	public void modelIndexCatTreeSave(@Param(value = "listTree") List<Map> listTree,
			@Param(value = "modelId") String modelId, @Param(value = "weight") double weight,
			@Param(value = "userId") String userId);

	public void saveIndexs(@Param(value = "indexTree") List<Map> indexTree, @Param(value = "modelId") String modelId,
			@Param(value = "userId") String userId);

	public void saveCategorys(@Param(value = "categoryTree") List<Map> categoryTree,
			@Param(value = "modelId") String modelId, @Param(value = "userId") String userId);

	public void updateWeight(@Param(value = "list") List<IndexCatModel> list);

	public void updateWeightSingle(@Param(value = "weight") String weight,
			@Param(value = "indexCatModelId") String indexCatModelId);

	public List<Map> getAllCatAndIndexes(@Param(value = "mainType") String mainType);

	public List<Map> getdefaultTree(@Param(value = "modelId") String modelId);

	public List<Map> getRelatedCategoryAndIndexes(@Param(value = "catId") String catId);

	public List<Map> getRelatedCategoryAndIndexesTreeByModelId(@Param(value = "modelId") String modelId);

	public List<Map> getRelatedCategoryAndIndexesByModelId(@Param(value = "modelId") String modelId);

	public List<Map> getRuleListByIndexModelCat(@Param(value = "indexCatModelId") String indexCatModelId);
	
	public List<Map> getRuleListByIndexModelCatForZz(@Param(value = "indexCatModelId") String indexCatModelId,@Param(value = "zzType") String zzType);

	public void saveRules(@Param(value = "list") List<Map> list,
			@Param(value = "indexCatModelId") String indexCatModelId, @Param(value = "modelId") String modelId);

	public void deleteRules(@Param(value = "indexCatModelId") String indexCatModelId);

	public void del(@Param(value = "ids") String[] ids);

	public void setStatus(@Param(value = "status") String status, @Param(value = "id") String id);

	public void updateStandard(@Param(value = "indexCatModelId") String indexCatModelId,
			@Param(value = "standard") String standard);

	public void deleteTreeBefore(@Param(value = "modelId") String modelId);

	public void deleteTreeBefore1(@Param(value = "modelId") String modelId);

	public void deleteTreeBefore2(@Param(value = "modelId") String modelId);

	public void deleteTreeBefore3(@Param(value = "modelId") String modelId);

	public void saveRanks(@Param(value = "list") List<Map> list, @Param(value = "id") String id,
			@Param(value = "cjr") String cjr);

	public void deleteRanks(@Param(value = "id") String id);

	public void saveCheckProcessForOrg(@Param(value = "orgId") String orgId, @Param(value = "id") String id,
			@Param(value = "checkType") String checkType, @Param(value = "checkProcess") String checkProcess,
			@Param(value = "templateType") String templateType);

	public Map<String, String> selectOne(@Param(value = "id") String id);

	public Map<String, String> selectCheckProcessForOrg(@Param(value = "orgId") String orgId,
			@Param(value = "id") String id);

	public int validateBm(@Param(value = "id") String id, @Param(value = "bm") String bm);

	public int validateSetStatus(@Param(value = "id") String id);

	public int validateModel(@Param(value = "id") String id, @Param(value = "zone") String zone,
			@Param(value = "industry") String industry, @Param(value = "reportType") String reportType,
			@Param(value = "mainType") String mainType);

	public List<Map> getRuleListByDict(@Param(value = "dictSource") String dictSource);

	public List<Map> selectModelForSelect(@Param(value = "mainType") String mainType);

	public void copyIndexCategoryModel(@Param(value = "relatedModel") String relatedModel,
			@Param(value = "id") String id, @Param(value = "addStr") String addStr, @Param(value = "cjr") String cjr);

	public void copyIndexCategory(@Param(value = "relatedModel") String relatedModel, @Param(value = "id") String id,
			@Param(value = "addStr") String addStr, @Param(value = "cjr") String cjr);

	public void copyCategory(@Param(value = "relatedModel") String relatedModel, @Param(value = "id") String id,
			@Param(value = "addStr") String addStr, @Param(value = "cjr") String cjr);

	public void copyModelRank(@Param(value = "relatedModel") String relatedModel, @Param(value = "id") String id,
			@Param(value = "addStr") String addStr, @Param(value = "cjr") String cjr);

	public void copyModelRule(@Param(value = "relatedModel") String relatedModel, @Param(value = "id") String id,
			@Param(value = "addStr") String addStr, @Param(value = "cjr") String cjr);

	public String selectModelIdByIndexCatModeId(@Param(value = "indexCatModelId") String indexCatModelId);

	public void updateStep(@Param(value = "step") String step, @Param(value = "id") String id);

	public List<Map<String, Object>> selectAllModelList(@Param(value = "name") String name,
			@Param(value = "page") Page page, @Param(value = "orgId") String orgId);

	public List<Map<String, Object>> selectModelList(@Param(value = "name") String name);

	List<Map<String, Object>> selectModelListByConditionForPage(@Param(value = "orgId") String orgId,
			@Param(value = "areaId") String areaId, @Param(value = "kId") String kId,
			@Param(value = "industryId") String industryId, @Param(value = "columns") List<String> showColumns,
			@Param(value = "additionalColumns") String[] additionalColumns, @Param(value = "page") Page page,
			@Param(value = "conditions") List<String> conditions);
	
	public int getProcessCount(@Param(value = "id") String id);
	
	public int getOrgModelCount(@Param(value = "id") String id);
	
	public List<Map> selectTemplateMap();
	
	public String selectMXSQ(@Param(value = "id") String id);

}